//import liraries
import React, { Component } from 'react';
import { View, Text, StyleSheet,NativeModules,ListView } from 'react-native';
let RNModules =  NativeModules.RTShopModules
import ShowTimeCell from './ListCell'
import {commonStyle} from '../../../constants/GlobalStyles'
// create a component
class Shop2 extends Component {
    constructor(props) {
        super(props)
        this.renderRow = this.renderRow.bind(this)
        this.state = {
          dataSource: new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2})
        }
    }
    componentDidMount (){
        RNModules.RNChangeTitle('店铺模块二')
        this.props.getMovieList()
    };
    componentWillUnmount() {
        RNModules.RNChangeTitle('店铺模块一')
    }
    renderRow(rowData, sectionId, rowId) {
        return (
            <ShowTimeCell key={rowId} rowData={rowData}/>
        )
      }
    render() {
        let dataSource = this.state.dataSource.cloneWithRows(this.props.shopList)
        return (
            <ListView
                style={styles.content}
                renderRow={this.renderRow}
                enableEmptySections
                dataSource={dataSource}
                />
            )
    }
}

// define your styles
const styles = StyleSheet.create({
    container: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
        backgroundColor: '#2c3e50',
    },
    content: {
        flex: 1,
        backgroundColor: commonStyle.white,
        marginTop: 64
      }
});

//make this component available to the app
export default Shop2;
